#include <graphics.h>
#include<stdio.h>
#include<conio.h>
#include<iostream>
#include<math.h>
#include <fstream> 
using namespace std;



int main()
{
    
    float x,x1,x12,x11,x2,y1,z1,th,y,c,z,dfi,l,fi,r,m,w,a;
    float k1,k2,k3,k4,l1,g,l2,l3,l4,p1,p2,p3,p4;
    g=0.5;
    
    fi=0;

    th=0.785;
    l=10;
    
    ifstream  inf("input.txt");             
    ofstream  outf("output.txt");

    cout<<"vvedite radius mahovika";
    cin>>r;
    cout<<"vvedite rasstoyanie ot opori do mahovika";
    cin>>a;
    cout<<"vvedite massu mahovika";
    cin>>m;
    cout<<"vvedite ckorost' vrasheniya mahovika";
    cin>>w;
    cout<<"vvedite ugol naklona mahovika";
    cin>>th;
    
    c=300*a;
    dfi=100*sin(th)/(m*r*r*w);
    
    initwindow(1366,768);
    moveto(600,500);
    setcolor(10);
    lineto(600,100);
    moveto(600,500);
    setcolor(12);
    
while(l>0)
{        
    for(fi=5;fi<200;fi=fi+dfi)
    {
       setcolor(9);
       moveto(600,500);
    
       l1=k1;
       l2=k2;
       l3=k3;
       l4=k4;
        
       k1=x=c*sin(th)*cos(fi+dfi);
       k2=y=c*sin(th)*sin(fi+dfi);
       k3=z=c*cos(th)-cos(fi)*(c/6);
       
       k4=x11=c*sin(th)*cos((fi+dfi)/2);
    
       circle(600+k2,500-k3,(k4*0.1));      
       lineto(600+k2,500-k3);

    

 
//-------------------------------------------    
     
      setcolor(0);
      moveto(600,500);
      circle(600+l2,500-l3,(l4*0.1));   
      circle(601+l2,501-l3,(l4*0.1));
      circle(599+l2,499-l3,(l4*0.1)); 
      circle(600+l2,501-l3,(l4*0.1));    
      circle(601+l2,500-l3,(l4*0.1));                 
      lineto(600+l2,500-l3);

      moveto(600,500);
      setcolor(10);
      lineto(600,100);
      moveto(600,500);


      delay(10);
  }
  
}     
    
    getch();   
    closegraph();
    return 0;    
}

